import React, { Component } from 'react'

class Life extends Component {
    state = {
        count:100
    }
    componentDidMount(){
        console.log("挂载完成");
    }
    componentDidUpdate(){
        console.log("数据更新");
    }
    componentWillUnmount(){
        console.log("组件卸载");
    }
    changeCount = ()=>{
        this.setState({
            count:200
        })
    }
    //当组件挂载完成之前，会执行render
    render() {
        console.log("render");
        return (
            <div>
                <h2>Life</h2>
                <p>{this.state.count}</p>
                <button onClick={this.changeCount}>修改count</button>
            </div>
        )
    }
}
export default Life